// 商品
import fetch from '@/config/fetch'

// 获取商品列表
export const listProduct = data => fetch('/goods/goods_list/', data);
// 查看商品详情
export const infoProduct = (id, data) => fetch("/goods/"+ id +"/goods_single/", data);
// 新增商品
export const addProduct = data => fetch('/goods/goods_add/', data, 'POST');
// 编辑商品
export const editProduct = (id, data) => fetch("/goods/"+ id +"/goods_update/", data, 'PUT');
// 删除商品
export const removeProduct = (id, data) => fetch("/goods/"+ id +"/goods_del/", data, 'DELETE');
// 批量删除商品
export const removeBatchProduct = data => fetch('/goods/goods_batch_del/', data, 'POST');
// 获取系统商品编码
export const getProductNo = data => fetch("/goods/goods_incr_id/", data, 'POST');

// 获取商品分类列表
export const getTreeList = data => fetch('/category/category_list/', data);
// 新增商品分类
export const addTreeItem = data => fetch('/category/category_add/', data, 'POST');
// 编辑商品分类
export const editTreeItem = (id, data) => fetch('/category/'+ id +'/category_update/', data, 'PUT');
// 删除商品分类
export const removeTreeItem = (id, data) => fetch('/category/'+ id +'/category_del/', data, 'DELETE');

// 盘点单列表
export const getStocktakingList = data => fetch('/stock_check/orders_list/', data);
// 新增盘点单
export const addStocktaking = data => fetch('/stock_check/orders_add/', data, 'POST');
// 盘点单详情
export const getStocktakingInfo = (id, data) => fetch("/stock_check/"+ id +"/orders_single/", data);
// 删除盘点单
export const removeStocktaking = (id, data) => fetch('/stock_check/'+ id +'/orders_del/', data, 'DELETE');

// 获取单位列表
export const getUnitList = data => fetch('/goods_unit/unit_list/', data);
// 新增单位
export const addUnit = data => fetch('/goods_unit/unit_add/', data, 'POST');
// 编辑单位
export const editUnit = (id, data) => fetch('/goods_unit/'+ id +'/unit_update/', data, 'PUT');
// 删除单位
export const removeUnit = (id, data) => fetch('/goods_unit/'+ id +'/unit_del/', data, 'DELETE');
// 商品副单位是否可以删除
export const deputyCanDelete = data => fetch('/goods/goods_can_del_deputy/', data, 'POST');

// 价格等级
// 列表
export const getPriceLevel = data => fetch('/price_level/level_list/', data);
// 新增
export const addPriceLevel = data => fetch('/price_level/level_add/', data, 'POST');
// 编辑
export const editPriceLevel = (id, data) => fetch('/price_level/'+ id +'/level_update/', data, 'PUT');
// 停用
export const stopPriceLevel = (id, data) => fetch('/price_level/'+ id +'/level_stop/', data, 'PUT');
// 启用
export const startPriceLevel = (id, data) => fetch('/price_level/'+ id +'/level_start/', data, 'PUT');
// 删除
export const removePriceLevel = (id, data) => fetch('/price_level/'+ id +'/level_del/', data, 'DELETE');

// 批量获取条形码
export const createBarcode = data => fetch('/goods/goods_barcode_list/', data, 'POST');
// 批量修改条形码
export const updateBarcode = data => fetch('/goods/batch_where_update_barcode/', data, 'POST');
// 检查条形码是否唯一
export const checkBarcode = data => fetch('/goods/goods_check_barcode/', data, 'POST');
// 批次列表查询
export const getBatchList = data => fetch('/account_name_id_goods/query_name_list/', data);
// 批次查询
export const queryBatch = data => fetch('/account_name_id_goods/query_data_list/', data);
// 保质期查询
export const queryQuality = data => fetch('/account_produce_date_goods/query_data_list/', data);
// 获取快捷改价商品列表
export const getUpdatePriceLists = data => fetch('/goods_unit_deputy/goods_list/', data); 
// 修改单个商品单位对应的价格
export const updateSinglePrice = data => fetch('/goods_unit_deputy/single_update_price/', data, 'POST');
